home *** CD-ROM | disk | FTP | other *** search
/ Hacker's Arsenal - The Cutting Edge of Hacking / Hacker's Arsenal - The Cutting Edge of Hacking.iso / texts / crack.txt < prev    next >
Text File  |  2001-07-11  |  88KB  |  2,316 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.                                                    The Cracking Manual
  47.          ─────────────────────────────────────────────────────────────
  48.                                  Written By The Cyborg - April 3, 1992
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.          Disclaimer
  57.          The author of this text shall hold no liability for special,
  58.          incidental, or consequential damages arising out of or
  59.          resulting from the use/misuse of the information in this
  60.          file.
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.                                                    The Cracking Manual
  70.  
  71.  
  72.  
  73.                                   INTRODUCTION
  74.  
  75.          Introduction
  76.          ------------
  77.               Welcome to the wonderful world of cracking.  What is
  78.          cracking?  If you don't know and you're reading this, ask
  79.          yourself why?  Anyway, cracking is the art of removing copy
  80.          protected coding from programs.  Why do this?  In recent
  81.          years, software companies have been fighting to keep copy
  82.          protection in their software to avoid their work to be
  83.          illegally copied.  Users feel that such copy protection is
  84.          ridiculous in that it violate their own rights to make
  85.          backups of their sometimes expensive investments.
  86.               Whichever side you may favor, this manual will go into
  87.          some detail on removing copy protection from programs.  If
  88.          you feel offended by this, then I would suggest you stop
  89.          here.  Please note, I do not endorse cracking for the illegal
  90.          copying of software.  Please take into consideration the hard
  91.          work and effort of many programmers to make the software.
  92.          Illegal copying would only increase prices on software for
  93.          all people.  Use this manual with discretion as I place into
  94.          your trust and judgement with the following knowledge.
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                      Page 1
  130.  
  131.  
  132.  
  133.  
  134.  
  135.                                                    The Cracking Manual
  136.  
  137.  
  138.  
  139.                                WHAT YOU WILL NEED
  140.  
  141.          What You Will Need
  142.          ------------------
  143.               Like all programming, cracking is the debugging stage of
  144.          software development.  It is the most tedious and hectic part
  145.          of programming as you shall see.  However, unlike software
  146.          development, you are given no source code, only the machine
  147.          level code commonly called machine language.  Cracking
  148.          demands patience.  No patience, no cracking.
  149.               Before we begin, you will need certain tools.  These
  150.          include:
  151.  
  152.               - A decent computer.  By this, I mean at minimum a 286
  153.                 computer with 2 or more megs of RAM.  A 386 is the
  154.                 ideal since it can load a debugger into usable memory.
  155.               - A source level debugger (eg. Turbo Debugger)
  156.               - A low level debugger (eg. DEBUG)
  157.               - An assembler system (eg. MASM, LINK, EXE2BIN)
  158.               - A hex dumping program (eg. Norton Utilities)
  159.  
  160.          The source level debugger is what you will try to be using
  161.          most of the time.  It provides many features that are a
  162.          convenience to the cracker, such as interrupt redirection.
  163.          Become comfortable with its features.  However, in some
  164.          instances, the source level debugger may not be suitable for
  165.          cracking huge games since the debugger itself may take up too
  166.          much memory.  In such a case, a low level debugger must be
  167.          used since their memory usage may be considered negligible.
  168.          This manual will focus on its use.
  169.               The assembler package will be used in the creation of
  170.          the famed loaders, which provide the cracker with dynamic
  171.          memory alterations without changing the original program.
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                      Page 2
  196.  
  197.  
  198.  
  199.  
  200.  
  201.                                                    The Cracking Manual
  202.  
  203.  
  204.  
  205.                        CRASH COURSE IN ASSEMBLY LANGUAGE
  206.  
  207.          Crash Course in Assembly Language
  208.          ---------------------------------
  209.               If you are already well familiar with the assembly
  210.          language, you may wish to skip this section.  Cracking
  211.          demands the knowledge of assembly language.  If you wish to
  212.          become a "serious" cracker, you might like to read up more
  213.          about this fascinating language.  This section will only give
  214.          you enough info for intermediate level cracking.
  215.               At this point, you should familiarize yourself with
  216.          DEBUG and its commands as we will be using them shortly.
  217.  
  218.          Registers
  219.          ---------
  220.               One of the neato things that you will be fooling around
  221.          most often with are called the registers.  Registers are like
  222.          variables (such as in BASIC) that are located within the CPU
  223.          itself.  These registers may hold a positive integer from 0
  224.          to 255 or from 0 to 65535.  They can also hold negative
  225.          integers from -128 to 127 or from -32768 to 32767.  The
  226.          registers are given names as follows:
  227.  
  228.               AX => accumulator - this register is most commonly used
  229.                     for mathematical or I/O operations
  230.               BX => base - this register is used commonly as a base or
  231.                     a pointer register (we'll talk more about this
  232.                     later)
  233.               CX => count - used commonly for counting instructions
  234.                     such as loops
  235.               DX => displacement - much like the base register
  236.  
  237.          The registers stated above are considered general purpose
  238.          registers, since they can basically be used to store whatever
  239.          the user wants.  Let's try putting some number in these
  240.          registers.  Type in "R {enter}".  You should see a bunch of
  241.          info, of which are four of the above mentioned registers.
  242.          Now, type in "RAX {enter}".  Then type in a number like
  243.          8FABh.  Type in "R" again and noticed how the accumulator
  244.          (AX) has change its number.
  245.               These general purpose registers can also be "split" in
  246.          half into its higher and lower order components.  Instead of
  247.          having one register AX, you can have two registers, AH and
  248.          AL.  Note however that while you have a range of 0 to FFFFh
  249.          for AX, you will now have a range of 0 to FF for AH and AL.
  250.          You cannot change these directly in debug, but be aware that
  251.          programs will use it.  If AX contains 0A4Ch, then AH will
  252.          contain 0Ah and AL will contain 4Ch.
  253.               The following are called the segment registers:
  254.  
  255.               CS => code segment - the block of memory where the code
  256.                     (instructions are located)
  257.               DS => data segment - the block of memory where data can
  258.                     be accessed.  In block move operations in which
  259.  
  260.  
  261.                                      Page 3
  262.  
  263.  
  264.  
  265.  
  266.  
  267.                                                    The Cracking Manual
  268.  
  269.  
  270.  
  271.                     huge blocks of memory are moved, this is commonly
  272.                     the segment in which the CPU reads from.
  273.               ES => extra segment - also another data segment.  In
  274.                     block move operations in which huge blocks of
  275.                     memory are moved, this is commonly the segment in
  276.                     which the CPU writes to.
  277.               SS => stack segment - this is the block of memory in
  278.                     which the CPU uses to store return addresses from
  279.                     subroutines.  (more on this later)
  280.  
  281.          In introductory level of cracking, we don't mess around with
  282.          these registers.  Later, we will see how we can use these to
  283.          trick a program into thinking other things, but that's later.
  284.          You can also change these registers in debug.  Type in "RCS
  285.          {enter}".  Then enter "0 {enter}" and notice how the CS
  286.          register changed.
  287.               There are other registers that we use to see what the
  288.          program is doing.  These registers can also be change in
  289.          debug.  Included are the following:
  290.  
  291.               SI => source index - this register is used in
  292.                     conjunction with block move instructions.  This is
  293.                     a pointer within a segment (usually DS) that is
  294.                     read from by the CPU.
  295.               DI => destination index - this register is also used in
  296.                     conjunction with block move instructions.  This is
  297.                     a pointer within a segment (usually ES) that is
  298.                     written to by the CPU.
  299.               BP => base pointer - a pointer used commonly with the
  300.                     stack segment
  301.               SP => stack pointer - another pointer used commonly with
  302.                     the stack segment (this one, you don't touch)
  303.  
  304.               By now, you may probably be confused about this
  305.          segment/pointer bit.  Here is an analogy that my straighten
  306.          things out.
  307.               Pretend you are in kindergarden learning to read.  There
  308.          are four black boards surrounding the room.  These black
  309.          boards are like SEGMENTS.  Let's pretend the front blackboard
  310.          is the code segment (CS).  The teacher has written some
  311.          instructions on pronunciation rules.  This is what the
  312.          students refer to when they try to pronounce words.  In a
  313.          program, this is what the CPU refers to when it follows
  314.          directions.
  315.               Okay, now the teacher has gone to the blackboard on the
  316.          left of the classroom.  We will call this board the data
  317.          segment (DS).  The teacher has also written a set of words on
  318.          the board.  Then she uses a wooden stick or a POINTER to
  319.          point to a word.  Let's pretend this stick is the source
  320.          index (SI).  She points to the word "their".  Now, the
  321.          students look at the front blackboard (CS) to see how to
  322.          pronounce the word and they say "their".
  323.               Now, the instructor wants the students to learn how to
  324.          write.  She points the stick to the word "apple".  The
  325.  
  326.  
  327.                                      Page 4
  328.  
  329.  
  330.  
  331.  
  332.  
  333.                                                    The Cracking Manual
  334.  
  335.  
  336.  
  337.          students pronounce the word.  Then she goes to the blackboard
  338.          on the right.  We shall call this one the extra segment (ES).
  339.          She then uses her finger as a different POINTER and points to
  340.          a location on the board where Mary Jane will write "apple".
  341.               That's basically what segments and pointers are.
  342.          Segments are the blackboards and pointers are the teacher's
  343.          stick (we're not talking sexually here) or finger.
  344.               One last important register is the flags register.
  345.          These registers control how certain instruction work, such as
  346.          the conditional jumps (in BASIC, they are like IF-THEN's).
  347.          They are stored as bits (0's or 1's) in the flags register.
  348.          We will most often use:
  349.  
  350.               zero => ZR/NZ (zero/not zero) - tells you whether an
  351.                       instruction (such as subtraction) yielded a zero
  352.                       as an answer
  353.               sign => NG/PL (negative/positive) - tells you whether an
  354.                       instruction yielded a positive or negative
  355.                       number
  356.               carry => CY/NC (carry/no carry) - tells you whether an
  357.                       instruction needed to carry a bit (like in
  358.                       addition, you carry a number over to the next
  359.                       digit).  Various system (BIOS) functions use
  360.                       this flag to denote an error.
  361.               direction => DN/UP (decrement/increment) - tells a block
  362.                       instruction to either move forward or backwards
  363.                       in reads and writes
  364.  
  365.          Try changing some of these bits.  Type in "RF {enter}".  Then
  366.          type in "DN {enter}" to change the direction flag to its
  367.          decrement position.
  368.  
  369.          The Instructions
  370.          ----------------
  371.  
  372.          MOV - move
  373.          ----------
  374.               Now we get to the actual instructions or commands that
  375.          the CPU will use.  The first instruction you will see most
  376.          often is the move instruction.  Its form is
  377.          MOV {destination},{source}.  Let's try programming now.  Exit
  378.          (q) and reenter debug again.  Now, type in "A {enter}".  You
  379.          will see a bunch of number to the left.  You can think of
  380.          these as line numbers.  Now type in "MOV AX,7A7A {enter}".
  381.          Then type "MOV DX,AX" and so on until your program looks
  382.          similar to the one below:  (type "U 100" to see)
  383.  
  384.          xxxx:0100 B8A77A         MOV    AX,7AA7
  385.          xxxx:0103 89C2           MOV    DX,AX
  386.          xxxx:0105 B90000         MOV    CX,0000
  387.          xxxx:0108 88D1           MOV    CL,DL
  388.          xxxx:010A 890E0005       MOV    [0500],CX
  389.          xxxx:010E 8B160005       MOV    DX,[0500]
  390.          xxxx:0112 BB0200         MOV    BX,0002
  391.  
  392.  
  393.                                      Page 5
  394.  
  395.  
  396.  
  397.  
  398.  
  399.                                                    The Cracking Manual
  400.  
  401.  
  402.  
  403.          xxxx:0115 26A30005       MOV    ES:[0500],AX
  404.  
  405.          Press enter again until you see the "-" prompt again.  You
  406.          are ready to run your first program.  Type "R {enter}" and
  407.          note the values of the general purpose registers.  Then type
  408.          in "T {enter}".  Debug will automatically display the
  409.          registers after the execution of the instruction.  What is in
  410.          the AX register?  It should be 7AA7h.  Now, "T" again.  What
  411.          is in the DX register?  It should also be 7AA7h.  Trace again
  412.          using "T" and note that CX should be 0 if it was not already.
  413.          Trace again and note what is in the CX register.  It should
  414.          be 00A7h.  Now trace another step.  What is this instruction
  415.          doing?  It is now moving the contents of CX into memory
  416.          location 500h in the data segment (DS).  Dump the memory by
  417.          typing in "D 500".  The first two two-digit numbers should be
  418.          the same as in the CX register.  But wait a minute you say.
  419.          They are not the same.  They are backwards.  Instead of
  420.          00A7h, it is A700h.  This is important.  The CPU stores 16
  421.          bit numbers in memory backwards to allow for faster access.
  422.          For 8 bit numbers, it is the same.  Now, continue tracing.
  423.          This instruction is moving the memory contents of address
  424.          500h into the DX register.  DX should be 00A7h, the same as
  425.          CX regardless of how it looked in memory.  The next trace
  426.          should be nothing new.  The next trace again moves the
  427.          contents of a register into memory.  But notice it is using
  428.          the BX register as a displacement.  That means it adds the
  429.          contents of BX and 500h to get the address, which turns out
  430.          to be 502h.  But also not the "ES:" in front of the address.
  431.          This additional statement tells the CPU to use the extra
  432.          segment (ES) rather than the data segment (DS which is the
  433.          default).  Now dump address 502h by entering "D ES:502" and
  434.          you should see A77Ah, which is backwards from 7AA7h.
  435.  
  436.          CMP/J? - compare/conditional jump
  437.          ---------------------------------
  438.               Another instruction you will see quite often is the CMP
  439.          or compare instruction.  This instruction compares the two
  440.          "variables" and changes the flags register accordingly.  The
  441.          source and destination operands are the same as those for the
  442.          move instruction.
  443.               Let's consider an example in which the AX register holds
  444.          21 and the BX register holds 22.  Then "CMP AX,BX" is
  445.          performed.  The compare instruction is like a subtraction
  446.          instruction, but it doesn't change the contents of the AX
  447.          register.  So, when 22 is subtracted from 21, the answer will
  448.          be -1, but we will never see the answer, only the flags which
  449.          have resulted from the operation.  Number 21 is less than 22,
  450.          so the carry flag and the sign flag should be set.  Just
  451.          remember that when the carry flag is set, the first number is
  452.          less than the second number.  The same is true for the sign
  453.          flag.  Why have two flags if they tell us the same thing?
  454.          This is more complicated and you should not concern yourself
  455.          with it.  It requires knowledge of hexadecimal arithmetic,
  456.          the denotation of signed and unsigned integers.
  457.  
  458.  
  459.                                      Page 6
  460.  
  461.  
  462.  
  463.  
  464.  
  465.                                                    The Cracking Manual
  466.  
  467.  
  468.  
  469.               So, now that we have done the compare instruction, there
  470.          will most likely be a conditional jump instruction after.  If
  471.          we wanted to jump if AX is less than BX (which it is), then
  472.          there would be an instruction like "JB 200".  This
  473.          instruction says Jump if Below to instruction 200h.  What
  474.          about if we wanted to jump if AX is greater than BX.  Then we
  475.          might have "JA 200".  This is read Jump if Above to
  476.          instruction 200.  What about AX equal to BX.  We would then
  477.          have "JZ 200" or "JE 200".  (Please note that the previous
  478.          instructions are synonymous.)  This is read Jump if Equal to
  479.          instruction 200h.  Here are the jumps you will most likely
  480.          encounter:
  481.  
  482.               Mnemonic  Flag(s) Checked  Description
  483.          -------------------------------------------------------------
  484.               JB/JNAE   CF=1             Jump if below/not above or
  485.                                          equal (unsigned)
  486.               JAE/JNB   CF=0             Jump if above or equal/not
  487.                                          above (unsigned)
  488.               JBE/JNA   CF=1 or ZF=1     Jump if below or equal/not
  489.                                          above (unsigned)
  490.               JE/JZ     ZF=1             Jump if equal/zero
  491.               JNE/JNZ   ZF=0             Jump if not equal/not zero
  492.               JL/JNGE   SF not equal     Jump if less/not greater or
  493.                         to OF            equal (signed)
  494.               JGE/JNL   SF=OF            Jump if greater or equal/not
  495.                                          less (signed)
  496.               JLE/JNG   ZF=1 or SF       Jump is less or equal/not
  497.                         not equal OF     greater (signed)
  498.               JG/JNLE   ZF=0 or SF=OF    Jump if greater/not less or
  499.                                          equal (signed)
  500.               JS        SF=1             Jump if sign
  501.               JNS       SF=0             Jump if no sign
  502.               JC        CF=1             Jump if carry
  503.               JNC       CF=0             Jump if no carry
  504.               JO        OF=1             Jump if overflow
  505.               JNO       OF=0             Jump if not overflow
  506.               JP/JPE    PF=1             Jump if parity/parity even
  507.               JNP/JPO   PF=0             Jump if no parity/parity odd
  508.  
  509.          There are all the possible combinations of conditional jumps
  510.          that you will encounter.  I realize that we have not
  511.          discussed some of the flags such as overflow or parity, but
  512.          be aware that they exist and programs sometimes use them.
  513.  
  514.          JMP - jump
  515.          ----------
  516.               This instruction does what it suggests.  It jumps too
  517.          different sections of code.  Several forms of the jump
  518.          instruction include:
  519.  
  520.          2E0B:0208 EBF6           JMP    0200
  521.          2E0B:020A 3EFF24         JMP    DWORD PTR DS:[SI]
  522.  
  523.  
  524.  
  525.                                      Page 7
  526.  
  527.  
  528.  
  529.  
  530.  
  531.                                                    The Cracking Manual
  532.  
  533.  
  534.  
  535.          The first instruction jumps to an address within the segment.
  536.          The latter instruction jumps to an address pointed to by ds:
  537.          si.  The DWORD says that this will be a far jump, a jump to a
  538.          different segment (a different blackboard).  So, if the
  539.          double word that is pointed to by ds:si contains 1000:0040h,
  540.          then, the instruction will jump to 1000:0040h whereas the
  541.          previous jump instruction will jump within the current
  542.          segment (or blackboard).
  543.  
  544.          CALL - procedural transfer
  545.          --------------------------
  546.               This instruction is the baby that you will be carefully
  547.          watching out for most often.  This instruction calls another
  548.          procedure and upon it's completion, will return to calling
  549.          address.  For example, consider the following block of code:
  550.  
  551.          2E0B:1002 E8BB46         CALL   56C0
  552.          2E0B:1005 7209           JB     1010
  553.          2E0B:1007 0C00           OR     AL,00
  554.  
  555.          The first line calls another procedure at "line number"
  556.          56C0h.  Upon its completion, the instruction pointer will
  557.          point to the second line.  Note that there is a "JC"
  558.          instruction.  Remember that programs often use the carry flag
  559.          to signal errors.  If the call instruction called a copy
  560.          protection instruction and you entered a wrong code or
  561.          something, it may return with the carry flag set.  The next
  562.          instruction would then jump if there was an error to an
  563.          exiting procedure.
  564.               Note, this is a near call.  A program can also have far
  565.          calls just like jumps.
  566.  
  567.          INT - generate an interrupt
  568.          ---------------------------
  569.               This instruction is much like the call instruction.  It
  570.          also transfers control to another procedure.  However, the
  571.          number after the INT instruction does not point to an
  572.          address.  Instead, it is a number pointing to an address that
  573.          is located in something called an interrupt vector.  You will
  574.          commonly see "INT 10", "INT 21", "INT 13".  Just know (for
  575.          now) that they are like calls to procedures.
  576.  
  577.          LODSB/LODSW/STOSB/STOSW - load/store a byte/word
  578.          ------------------------------------------------
  579.               These instructions either load in or store a byte or a
  580.          word to or from memory.  The DS:SI register pair points to
  581.          the source data.  These are the registers the CPU will use
  582.          when reading from memory using the LODS instruction.  The
  583.          AX/AL register will hold the number to either read from or
  584.          write to the memory.  So, if DS:SI points to a byte which is
  585.          maybe 60, then a "LODSB" instruction will load in the number
  586.          60 into the AL register.  A LODSB or STOSB will use the AL
  587.          register while the LODSW or STOSW will use the AX register.
  588.               The STOS writes whatever is in the AX/AL register to the
  589.  
  590.  
  591.                                      Page 8
  592.  
  593.  
  594.  
  595.  
  596.  
  597.                                                    The Cracking Manual
  598.  
  599.  
  600.  
  601.          memory pointed to by ES:DI.  So, if ES:DI points to 100:102h
  602.          and if AL held 50, then the byte at 100:102h will hold 50.
  603.               After the instruction is finished, the CPU will either
  604.          increment or decrement SI or DI according to the status of
  605.          the direction flag.  So, if SI was 100h and a "LODSW"
  606.          instruction was performed with a cleared direction flag
  607.          (forward), the SI will now point to 102h.
  608.  
  609.          MOVSB/MOVSW - copies a byte/word from source to destination
  610.          -----------------------------------------------------------
  611.               This instruction gets a byte or a word from the data
  612.          pointed to by DS:SI and copies it to the data pointed to by
  613.          the ES:DI address.  When the instruction is finished, SI and
  614.          DI will be incremented or decremented accordingly with the
  615.          status of the direction flag.  So, if DS:SI pointed to a byte
  616.          with the number 30, a "MOVSB" instruction would copy into the
  617.          byte pointed to by ES:DI the number 30.
  618.  
  619.          REP - repeat
  620.          ------------
  621.               The REP instruction in front of a MOVS/LODS/STOS would
  622.          cause the MOVS/LODS/STOS instruction to be repeated for a
  623.          number of times specified in the CX register.  So, if CX
  624.          contained 5, then "REP STOSB" would store whatever was in the
  625.          AL register into the byte pointed to by ES:DI five times,
  626.          increasing DI each time.
  627.  
  628.          LOOP - looping
  629.          --------------
  630.               The LOOP instruction repeats a block of instructions for
  631.          a certain number of times.  This number will be held in the
  632.          CX register.  Each time we reach this instruction, the CPU
  633.          will decrement the CX register and jump to a specified
  634.          instruction until CX becomes zero.  This instruction looks
  635.          like "LOOP 1A00" where the number indicates the instruction
  636.          address to loop to.
  637.  
  638.          Arithmetic Operators
  639.          --------------------
  640.               Arithmetic instructions allow you to perform various
  641.          arithmetic function of data.  "ADD" and "SUB" work the same
  642.          way as "MOV" instructions do in that it subtracts whatever is
  643.          in the source register from the destination register and
  644.          stores it in the destination register.
  645.               The "MUL" and "DIV" instructions are a bit more
  646.          complicated and they are not used as intensively as the "ADD"
  647.          or "SUB" since they are slow, so we will not talk about them.
  648.               There are also a multitude of other instructions that
  649.          you should familiarize yourself with if you are thinking of
  650.          becoming a serious cracker.  The instructions given above are
  651.          only the BARE minimum that you need.  There is no way around
  652.          learning assembly for better cracking.
  653.  
  654.  
  655.  
  656.  
  657.                                      Page 9
  658.  
  659.  
  660.  
  661.  
  662.  
  663.                                                    The Cracking Manual
  664.  
  665.  
  666.  
  667.                                   THE CRACKING
  668.  
  669.          The Cracking
  670.          ------------
  671.               Now the fun stuff begins.  First, we must discuss the
  672.          different forms of copy protection schemes.  They are
  673.          basically divided into the disk based and manual based copy
  674.          protection schemes.
  675.               With disk based schemes, the software often reads from
  676.          specific sectors on a disk to determine the disk's validity.
  677.          How can this be done?  When you perform a disk format, the
  678.          disk is formatted with specific sector sizes.  Once the
  679.          sector size changes, DOS cannot recognize it, thinking that
  680.          it is a bad sector.  Since this looks like a bad sector, a
  681.          simple DISKCOPY will not work in copying such disks.
  682.          Interrupt 13h (the assembly mnemonic is INT 13) was commonly
  683.          used to handle such copy protections.  It is now very rare to
  684.          encounter the once famed INT 13h copy protection method
  685.          nowadays since it was quite easy to defeat.  Any professional
  686.          commercial software will often use their own custom based
  687.          disk I/O routines.  This involves intimate access to I/O
  688.          ports using IN and OUT instructions.  This is beyond the
  689.          scope of the first release of this manual.  However, if you
  690.          are lucky, the I/O functions might be called from a "CALL"
  691.          instruction in which case you may defeat the protection
  692.          without much difficulty.  Another disk based scheme used to
  693.          denote legality of software is used during the installation
  694.          process of the software.  With certain programs, when you
  695.          install it, it copies the files into the hard drive.  But it
  696.          also sets a specific sector in the hard drive so that the
  697.          program can recognize it.  This is also similar to diskette
  698.          copy protections, but can be defeated in much the same way.
  699.               Thank goodness that disk based copy protections are
  700.          almost completely out of the software industry.  However, a
  701.          sometimes more difficult copy protection scheme has arisen
  702.          that may sometimes prove to be even more difficult to crack.
  703.          These schemes are commonly known as the doc checks in which
  704.          the user must have a copy of the manual to bypass the
  705.          protection.  With programs compiled as true assembly (you can
  706.          call then "normal" programs), these protections are not too
  707.          bad to trace through and crack.  With programs that run
  708.          scripts (such as Sierra games), this can he a real chore
  709.          however.  Why?  It is because it is like running a program
  710.          within a program.  You just have to be very very patient in
  711.          this case, carefully tracing through the instructions.
  712.               As if these copy protection schemes weren't enough,
  713.          software companies have also added trace inhibition schemes
  714.          to their code.  What does this mean?  This means that you
  715.          will have a hell of a time trying to trace through code.
  716.          However, if you know how these things work, it should not be
  717.          too much of a problem.
  718.               Run-time compression/decompression and
  719.          encryption/decryption of files also make changes to the
  720.          program difficult.  In this case, the loader sure comes in
  721.  
  722.  
  723.                                     Page 10
  724.  
  725.  
  726.  
  727.  
  728.  
  729.                                                    The Cracking Manual
  730.  
  731.  
  732.  
  733.          handy.  Also, when the data within the file changes due to
  734.          overlays, loaders are also good to use.
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.                                     Page 11
  790.  
  791.  
  792.  
  793.  
  794.  
  795.                                                    The Cracking Manual
  796.  
  797.  
  798.  
  799.                           DISK BASED COPY PROTECTIONS
  800.  
  801.          Disk Based Copy Protection
  802.          --------------------------
  803.               Since disk based copy protection schemes are rarely
  804.          used, we will not go into great depth in its discussion.
  805.  
  806.          INT 13h
  807.          -------
  808.               I have previously mentioned that INT 13h copy protection
  809.          schemes are hardly ever used anymore.  Nevertheless, it would
  810.          be good practice for the beginner to learn how to defeat the
  811.          code.  You will most likely see INT 13h used with function 2,
  812.          read sector.  This means that:
  813.  
  814.               AH => will contain the number 2 (function 2)
  815.               AL => the number of sectors to read in.  This is
  816.                     commonly only 1 since you just want to check a few
  817.                     sectors for disk validity.
  818.               CH => will contain the cylinder number
  819.               CL => will contain the sector number
  820.               DH => will contain the head number
  821.               DL => will contain the drive number
  822.                     00h - 7Fh for floppies
  823.                     80h - FFh for fixed disks
  824.               ES:BX => will point to the address into which the data
  825.                     read from the disk will be written to
  826.  
  827.               Upon the return for this interrupt, if the carry flag is
  828.          set, that means that the program could not read the sector,
  829.          and therefore the disk is valid.  If the carry flag is clear,
  830.          that meant that INT 13h could read the sector properly and so
  831.          the disk would be bad in the eyes of the program, thinking it
  832.          was a copied disk.
  833.               Okay, now that we know to look for INT 13h in the
  834.          program code, we can begin tracing.  First, we must know the
  835.          difference between debug's "T" and "P".  "T" is the trace
  836.          instruction, which tells it to follow instructions step by
  837.          step.  That also means that in LOOP or REP instruction, the
  838.          trace will patiently go through the loop until finished.
  839.          Also, during CALL instructions, trace will go into the call
  840.          and execute the instructions pointed to by the call
  841.          instruction.  The "P" command is similar to the "T" but with
  842.          the difference in that it traces over instructions.  That
  843.          means that if it encounter a LOOP or REP, it will quickly
  844.          finish up the loop and point to the next instruction.  With a
  845.          CALL, the "P" (proceed) will not go into the subroutine.
  846.          Instead, it will just execute the procedure, then point to
  847.          the next instruction.
  848.               Okay, before you start tracing for hours through a
  849.          program, you must first notice when and where the copy
  850.          protection appears.  Run the program in DOS first and make
  851.          careful note of when things happen.  You might see an intro
  852.          screen, then the music pops up, then the menu comes out.
  853.  
  854.  
  855.                                     Page 12
  856.  
  857.  
  858.  
  859.  
  860.  
  861.                                                    The Cracking Manual
  862.  
  863.  
  864.  
  865.          Notice this so you will know where you are in the program.
  866.               Once you have done that, you can begin debugging the
  867.          program.  Whenever you start out with a program, you use "P"
  868.          to trace through the program.  Be patient as this might take
  869.          a while.  While you are tracing, watch out for CALLs and
  870.          INTerrupts.  When you are just about to execute the step, try
  871.          to remember the segment and offset of the instruction.  The
  872.          segment is the number to the left of the colon while the
  873.          offset is the number to the right.  As you continue tracing
  874.          through the program, you will find that the screen might
  875.          blank and display the intro screen or something like that.
  876.          This is a good sign and it tells you that you are headed in
  877.          the right direction.  Start slowing down when you feel that
  878.          you are near to the copy protection.
  879.  
  880.          Situation 1 - Exit from copy protected CALL
  881.          -------------------------------------------
  882.               Oops, you have traced over a call that accessed drive A.
  883.          Unfortunately, you also exited the program.  That's good.
  884.          You have just narrowed down the location of the copy
  885.          protection code.  Now I hope you remembered the address of
  886.          that CALL.  If not, you gotta start all over to find it.
  887.          Anyway, restart the program now.  Now Go to that instruction
  888.          by "G {segment:address}".
  889.               Did something go wrong?  Did the computer freeze or
  890.          something?  It is most likely that this is an overlay or
  891.          encrypted code or something that caused the code at that
  892.          location to change.  In this case, you will have to remember
  893.          the addresses of various instructions along the way.
  894.          Instructions that you want to take note of are far calls (if
  895.          you remember, calls with a segment:offset address as their
  896.          operand).  You don't have to do this for every call.  As you
  897.          crack more and more, you will get the hang of which
  898.          instructions to keep track of.
  899.               Okay, let's assume you have gotten back into the
  900.          location of the code again.  It is a CALL instruction that
  901.          will access the disk drive.  At this point, try skipping the
  902.          CALL instruction.  To do this, type in "RIP {enter}".  Then
  903.          type in the address of the next instruction.  Then execute
  904.          the do or die instruction, "G".  If the program runs fine
  905.          without asking for the copy protection, congratulations!  You
  906.          have cracked the program.
  907.               If the program freezes or does something weird, restart
  908.          the program and trace back to the suspected copy protected
  909.          location.  Now use the "T" command once and start using "P"
  910.          again.  Remember to write down the address of that CALL
  911.          instruction you just traced into so you can come back to it
  912.          quickly.  As you keep tracing, using the above procedures,
  913.          pretend you eventually come up to an INT 13h instruction.
  914.          See what it does by tracing over it.  Make sure you have a
  915.          disk in drive A too.  If there was no error, force an error
  916.          by turning on the carry flag and proceeding.  With INT 13h
  917.          copy protections, this should be sufficient to crack the
  918.          program.
  919.  
  920.  
  921.                                     Page 13
  922.  
  923.  
  924.  
  925.  
  926.  
  927.                                                    The Cracking Manual
  928.  
  929.  
  930.  
  931.          Situation 2 - Return from copy protected CALL
  932.          ---------------------------------------------
  933.               Okay, the CALL that you just traced over accessed the
  934.          disk drive, but it didn't kick you out.  Keep on proceeding
  935.          and this point.  If there is an instruction that causes you
  936.          to jump because of a carry flag, try fooling around with this
  937.          carry flag and see how the program reacts.  INT 13h copy
  938.          protections are usually simple enough for you to just change
  939.          the carry flag to allow the program to bypass the copy
  940.          protection.
  941.  
  942.          Access to the Hard Drive
  943.          ------------------------
  944.               The cracking for installation software is also the same
  945.          as cracking for the INT 13h.  You just keep tracing until you
  946.          see some disk activity.  At that point, you try messing
  947.          around with some of the conditional jumps to see what
  948.          happens.  If you have the original program, you should run it
  949.          also to see the differences between the valid and invalid
  950.          copies.
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.                                     Page 14
  988.  
  989.  
  990.  
  991.  
  992.  
  993.                                                    The Cracking Manual
  994.  
  995.  
  996.  
  997.                            DOC CHECK COPY PROTECTIONS
  998.  
  999.          Doc Check Copy Protections
  1000.          --------------------------
  1001.               Okay, we have just quickly scanned over disk based copy
  1002.          protections because they are rarely used nowadays.  Doc
  1003.          checks will be discussed in greater detail for the rest of
  1004.          this manual.
  1005.               Unlike the disk based protections, which are based on
  1006.          hardware identification, doc checks are based on software
  1007.          identification.  Therefore, the only information that will
  1008.          indicate that a copy protection is happening is the screen,
  1009.          unlike the whirr of the disk drive.  The moral, watch the
  1010.          screen.  Because this copy protection is software based, it
  1011.          will be more of a challenge to trace, but of course, that is
  1012.          the "fun" part of cracking.
  1013.  
  1014.          The Basics
  1015.          ----------
  1016.               Make sure you have the COMPLETE version of the program
  1017.          you are about to crack.  When you do, run the program in DOS.
  1018.          While the program is loading, take note of exactly what goes
  1019.          on with the screens, sounds, etc.  Here is what you might
  1020.          want to note:
  1021.  
  1022.               1)  What comes up first?  Is it a standard text output
  1023.                   that asks you for the type of graphics adaptor you
  1024.                   have, the number of joysticks, the sound card?
  1025.               2)  When does the intro screen come up?  Is it after the
  1026.                   music starts?  After the copyright notice?  After
  1027.                   the text prompt for the graphics mode you will be
  1028.                   operating in?
  1029.               3)  What happens now?  An animated sequence that brings
  1030.                   you through the beginning plot of a game?  If so,
  1031.                   can you press a key and escape from it?
  1032.               4)  Now what?  Is there a main menu?  When you start the
  1033.                   game by selecting the "START GAME" option from the
  1034.                   menu, does the copy protection come up immediately?
  1035.               5)  If it doesn't come up immediately, when does it come
  1036.                   up?
  1037.               6)  Does the copy protection only appear when you are
  1038.                   playing the game, or does it come up also when you
  1039.                   select "CHANGE OPTIONS" from the main menu?
  1040.  
  1041.          Obviously, these questions are merely prompts for you to
  1042.          follow.  Use your own mind in discovering what to take note
  1043.          of.  There are no set rules for cracking.  It is a puzzle
  1044.          that you must use your mind on.
  1045.               Okay, once you have run the program, go into your
  1046.          debugger (in our case, DEBUG) and load up the program.  One
  1047.          tip to use when you first start out programming is to use the
  1048.          "P" command to trace through code.  As you become a more
  1049.          advanced cracker, you might start seeing patterns in coding.
  1050.          These patterns are characteristic of high level programming
  1051.  
  1052.  
  1053.                                     Page 15
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.                                                    The Cracking Manual
  1060.  
  1061.  
  1062.  
  1063.          languages (Pascal, C, etc.) and are usually the
  1064.          initialization code for the rest of the program.  Use "P" for
  1065.          each instruction, one at a time.  Be patient as this might
  1066.          take a while.
  1067.               Okay, you have been tracing for some time now and
  1068.          finally, you notice something happen.  The screen might have
  1069.          blanked or maybe a message prompting you to enter the
  1070.          graphics mode may have popped up.  Was this what you have
  1071.          noted before?  It should be and you can assure yourself that
  1072.          you are headed in the right direction.  As you keep tracing
  1073.          programs, you notice that CALLs usually do something
  1074.          significant.  A CALL might clear the screen or sound some
  1075.          music.  When it does something rad like this, write down its
  1076.          address as the segment:offset pair.  The segment is the
  1077.          number to the left of the colon while the offset is the
  1078.          number to the right of the colon.  Don't be a dork and set a
  1079.          breakpoint there.  Write it down on paper or something.  We
  1080.          will see later on why breakpoints fail miserably in the cool
  1081.          wares.
  1082.               Why take note of these instructions?  As you trace
  1083.          deeper and deeper into programs, the coding often loads up
  1084.          overlays or maybe decompresses code to the memory location
  1085.          that you have just traced over.  Therefore, if you set a
  1086.          breakpoint there, or execute a "G" instruction to that
  1087.          address, you will fuck up the program and cause your computer
  1088.          to freeze.  We will see why when we examine how breakpoints
  1089.          and single stepping works.
  1090.               Also, while you are tracing using "P", mentally remember
  1091.          the addresses of the CALLs.  That way, if you trace over a
  1092.          call that brought you immediately to the copy protection, you
  1093.          won't have to retrace the code again.  You don't have to
  1094.          write down all of the addresses, of course, just remember one
  1095.          at a time and write them down if they do anything
  1096.          significant.
  1097.  
  1098.          Code Guards Through Keyword Entry
  1099.          ---------------------------------
  1100.               Okay, you know that the copy protection is one in which
  1101.          the program waits for you to type in a keyword that you have
  1102.          to look up in the manual or something.  Here are then
  1103.          following steps you should take.
  1104.  
  1105.          Situation 1 - Return from a copy protected CALL
  1106.          -----------------------------------------------
  1107.               When a copy protection coding reveals itself on the
  1108.          screen, you can have a situation in which you are returned to
  1109.          the debugger, waiting for the next instruction to be
  1110.          executed.  Now, suppose that the CALL asked you to enter a
  1111.          code.  You entered an incorrect code and were returned to the
  1112.          debugger, but you have not exited the program.  Make sure
  1113.          that you have previously recorded the address of this CALL.
  1114.          Now, you can do two things, (1) you can try skipping over the
  1115.          CALL, (2) you can trace on further.  As you become more
  1116.          experienced, you will be able to better decide.  As one with
  1117.  
  1118.  
  1119.                                     Page 16
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.                                                    The Cracking Manual
  1126.  
  1127.  
  1128.  
  1129.          experience, however, I can say that 90% of the time, you will
  1130.          have to trace further on, but hey, you might get lucky.
  1131.               For now, let's say you are lazy and decide that you want
  1132.          to skip over the call to see what happens.  To do this, you
  1133.          must restart the program.  Then trace your way back to the
  1134.          CALL where the copy protection was located.  Use "G
  1135.          {segment:offset}" to do this.  If, for some reason, the
  1136.          computer freezes when you do this, you will have to use "G"
  1137.          followed by the addresses of the CALLs that you have noted
  1138.          down to be significant.  If that doesn't work, resort to
  1139.          retracing the code over again.  As you become more
  1140.          experienced, you will find that you rarely have to retrace
  1141.          the entire code since you can "feel" what is going on.  Okay,
  1142.          now that you are at the location of the CALL, this is the
  1143.          time to skip over the instruction.  To do this, enter "RIP"
  1144.          and then the address of the next instruction's address.  Now
  1145.          enter the "G" command and see what happens.  If the program
  1146.          runs just fine, you've cracked the program.  If the program
  1147.          kicks you out or crashes, you have to do some more tracing.
  1148.               Okay, so you've decided to continue tracing from the
  1149.          point of the copy protection.  There are usually a bunch of
  1150.          CMP and J? CMPS? instructions after the call.  This point on
  1151.          is the difficulty of cracking for a beginner since you don't
  1152.          know what the fuck is going on.  All those compares and jumps
  1153.          don't mean shit to you are you are about to pass out in
  1154.          frustration.  Don't distress, here are a few tips I can give
  1155.          you.  If these don't work, you gotta find out your own
  1156.          solutions to the problem.
  1157.               Okay, in all probability, the CALL that you just traced
  1158.          over was acting as a read string procedure (like BASIC's
  1159.          INPUT).  That means somewhere in the computer's memory, there
  1160.          lies the code that you typed in and the code that you were
  1161.          supposed to have typed in.  What this would mean is that the
  1162.          code after the CALL will do some sort of string comparison.
  1163.          Look out for these.  It might be hidden inside another CALL
  1164.          if you're lucky.  In such a case, does the program kick you
  1165.          out?  If it does, you have to trace into the call using "T"
  1166.          to see what is going on.  Okay, the string comparison will
  1167.          most likely take the form of some kind of loop.  Maybe "REP
  1168.          CMPSB" or "LOOP".  In the case of the REP CMPSB, there might
  1169.          be a JZ/JNZ or JCXZ/JECXZ that follows it.  When strings
  1170.          match, the CX register will be zero.  If CX is not zero, the
  1171.          strings are not the same and the conditional jump will
  1172.          probably jump to an exit routine.  All you have to do is to
  1173.          change the status of the zero flag.  Then, try out the "G"
  1174.          instruction.  If it still didn't work, start over and do some
  1175.          more tracing.  If the string compare is not of the REP form,
  1176.          there will be some kind of loop that will check between two
  1177.          memory locations.  In such a case, you will just have to
  1178.          become accustomed to realizing that the code is a string
  1179.          compare.  There is no standard code for this.  If you know
  1180.          you have entered a wrong code, trace through the loop and see
  1181.          where in the loop you are thrown out of the loop.  At this
  1182.          point, you can go back to it, change some flags to make sure
  1183.  
  1184.  
  1185.                                     Page 17
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.                                                    The Cracking Manual
  1192.  
  1193.  
  1194.  
  1195.          you stay in the loop.  When you exit through a different
  1196.          location, you have probably bypassed the code and now, you
  1197.          can enter "G" to see what happens.
  1198.  
  1199.          Situation 2 - Exit from a copy protected CALL
  1200.          ---------------------------------------------
  1201.               When a copy protection coding reveals itself on the
  1202.          screen, you can have a situation in which you are not
  1203.          returned to the debugger, instead, causing you to exit the
  1204.          program.  In this case, you have to restart the program and
  1205.          trace into the CALL using "T".  After that, you can start
  1206.          using "P" again to uncover the location of the code.  You
  1207.          will most likely encounter a condition that will resemble
  1208.          situation 1.  Follow its instructions.
  1209.  
  1210.          Shortcuts For Keyword Entry Protections
  1211.          ---------------------------------------
  1212.               With keyword entry systems, you might be lucky to have
  1213.          the codes stuck somewhere into file in its
  1214.          uncompressed/unencrypted form.  This means that you can "see"
  1215.          the keywords in its ASCII format.  This case is cool because
  1216.          you won't have to do any tracing to crack the program.  All
  1217.          you have to do is to dump the contents of the files to find
  1218.          something that looks like a keyword.  (Always backup the file
  1219.          that you are about to alter.)  When you have found such a
  1220.          file and the location of the codes, all you have to do now is
  1221.          to change the codes to values that you know.  For example,
  1222.          one code might call for you to enter "PIRATE".  It's a bitch
  1223.          if you don't know the code.  But if you change the code to
  1224.          your name or something else you will never forget ("CYBORG"),
  1225.          then you'd be set.
  1226.               However, in most instances, you can't simple just type
  1227.          over the old code with your new code.  In high level
  1228.          languages, these codes are stored as strings.  In 'C',
  1229.          strings are stored in their ASCII equivalent.  They are then
  1230.          terminated with a NULL character (this is a 0).  In Pascal,
  1231.          the lengths of the strings are first stored in the first
  1232.          position.  Then, the ASCII is stored.
  1233.  
  1234.          NULL Terminated Strings
  1235.          -----------------------
  1236.               So, if you see zeros after the codes, this is a NULL
  1237.          terminated string.  Now, start at the beginning of the string
  1238.          and enter your code.  Then, enter the '0'.  Make sure your
  1239.          string is less than the original string since 'C' refers to
  1240.          these strings also with pointers.
  1241.  
  1242.          Pre-Length Indentifier
  1243.          ----------------------
  1244.               If you see numbers before strings, enter your own code.
  1245.          Then change the length of the code appropriately.  Make sure
  1246.          you do not exceed the length of the original string.
  1247.  
  1248.  
  1249.  
  1250.  
  1251.                                     Page 18
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.                                                    The Cracking Manual
  1258.  
  1259.  
  1260.  
  1261.          Code Guards Through Pointed Icons
  1262.          ---------------------------------
  1263.               We have a case where we do not type in keywords.
  1264.          Rather, we must use a pointer device such as the cursor keys
  1265.          on the keyboard, the mouse, or joystick.  These protections
  1266.          are a bit more complicated since there are no strings to
  1267.          compare against.  Rather, the input will be a number stored
  1268.          in memory or a register.  This is what makes this copy
  1269.          protection more difficult to crack.  We have to hunt through
  1270.          code to find out which compare instruction is the key.
  1271.               What you have to do is to find the general location of
  1272.          the copy protection code as before.  Then, instead of typing
  1273.          in the keyword, you select the icon.  Like before, you must
  1274.          step slowly through the code and go until the program JUST
  1275.          STOPS asking you for the code.  For example:
  1276.  
  1277.          2E0B:0000 E8740E         CALL   0E77
  1278.          2E0B:0003 38D0           CMP    AL,DL
  1279.          2E0B:0005 7569           JNZ    0070
  1280.          2E0B:0007 CB             RETF
  1281.  
  1282.          You might decide to trace over the call at address xxxx:0000.
  1283.          But then, you see that the screen displayed the icons and you
  1284.          got to select the code.  Then, the procedure does some disk
  1285.          activity and you return to address xxxx:0003.  If you see
  1286.          something happen after you have just finished entering the
  1287.          code or if it is slow in returning you to debug, then,
  1288.          some code must have been performed before you returned.  In
  1289.          this case, you must trace into the CALL to see what has
  1290.          happened.  If not, there is still a small probability that
  1291.          there were some instructions that formatted the code you
  1292.          entered and saved it to a memory location.  (We'll talk about
  1293.          multiple doc checks later.)
  1294.               Realize that most of the programs that you will be
  1295.          cracking have been programed by C or some other high level
  1296.          language.  These languages often use the stack (SS:SP) to
  1297.          pass parameters (variables) or to create local variables for
  1298.          a procedure's use.  Most likely, you will see compares to
  1299.          data contained within the stack such as "CMP AX,WORD PTR
  1300.          [BP+10]" or "MOV DX,WORD PTR [BP+10]".  This is what you hope
  1301.          to find, although not always the case.  If you do see some
  1302.          access via the stack using the BP register as a pointer, you
  1303.          may have something there.  Then, all you would have to do is
  1304.          to mess around the flags register (most likely, JZ/JE will be
  1305.          used) at the compare instruction.
  1306.  
  1307.          Multiple Doc Checks
  1308.          -------------------
  1309.               There are some wares that invoke multiple doc checks,
  1310.          doc checks that pop up either systematically or randomly.  In
  1311.          addition, there could also be two types of this protection.
  1312.          The doc check could be a similar type (eg. typing the code
  1313.          found on page...) or they could be different (eg. typing in
  1314.          the code on page... then select the correct icon), although
  1315.  
  1316.  
  1317.                                     Page 19
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.                                                    The Cracking Manual
  1324.  
  1325.  
  1326.  
  1327.          the latter is more rarely used due to its extensive memory
  1328.          usage.
  1329.  
  1330.          Situation 1 - Similar doc checks
  1331.          --------------------------------
  1332.               Cracking multiple doc checks that are similar is just
  1333.          like cracking with just one doc check.  The procedure to
  1334.          trace is still the same.  Keep Proceeding until you come up
  1335.          to the CALL that contains the copy protection.  Just use the
  1336.          sequences mentioned above.  When you are absolutely positive
  1337.          that the call contains the copy protection (skip the CALL and
  1338.          see what happens; if the protection has been bypassed but
  1339.          appears at other times, you got something), here is what you
  1340.          do.
  1341.  
  1342.               1)  Note what type of CALL it was.  Near if the operand
  1343.                   (number after the CALL) was a four digit number or
  1344.                   far if the operand contained the segment:offset
  1345.                   pair.
  1346.               2)  Trace INTO the call.
  1347.               3)  At the first instruction, note the address inside
  1348.                   the CALL.
  1349.               4)  Then, type in "A" then the address of that very
  1350.                   first instruction.
  1351.               5)  If there was a near call performed, now type in
  1352.                   "RETN", otherwise, type in "RETF".
  1353.               6)  Now run the program ("G") and see what happens.
  1354.  
  1355.          If this call was definitely the copy protection, you should
  1356.          have bypassed the copy protection completely.  Otherwise, you
  1357.          might have a case like situation 2.
  1358.  
  1359.          Situation 2 - Different doc check types
  1360.          ---------------------------------------
  1361.               Again, cracking multiple doc checks are like cracking
  1362.          single doc checks.  You follow the same procedures until you
  1363.          come up to a copy protected location.  Then, you would trace
  1364.          into the code as explained in situation 1 just to make sure
  1365.          that the code is not called up again.  Different doc checks
  1366.          are a bitch to do because you have to manually keep tracing
  1367.          until you find each one to effectively rid yourself of the
  1368.          copy protection.  There is not sure way of getting rid of all
  1369.          the doc checks any other way.  But luckily, there are very
  1370.          few wares out there like this.  Remember, the more the
  1371.          company shoves into the program's memory, the more money it's
  1372.          gonna cost them.
  1373.  
  1374.               Of course, I cannot cover every single type of doc check
  1375.          since there are too many of them.  You'd just have to use
  1376.          your own imagination to solve some of them.
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.                                     Page 20
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.                                                    The Cracking Manual
  1390.  
  1391.  
  1392.  
  1393.                                SPECIAL SITUATIONS
  1394.  
  1395.          Special Situations
  1396.          ------------------
  1397.               What all crackers are faced with at one time or another
  1398.          are situations that call for intuitive thinking to overcome
  1399.          the barrier.  Remember, there is no one sure way of cracking.
  1400.  
  1401.          INT 3 - Problems During Tracing
  1402.          -------------------------------
  1403.               Sometimes, when you start cracking, you just find your
  1404.          instruction pointer messing up.  You keep tracing and
  1405.          tracing, then your computer freezes.  But then, when you type
  1406.          "G" at the beginning of the program, it works just fine.
  1407.          What is happening here?  There are several things that the
  1408.          program could do to impede tracing.  Unless you have a
  1409.          hardware debugger, you have to settle in for more primitive,
  1410.          intuitive methods.  First, we have to find out how a software
  1411.          debugger works.
  1412.               I now introduce you to INT 3 and INT 1.  They are the
  1413.          breakpoint and single stepping interrupts respectively.  We
  1414.          will be looking at INT 3 the most.
  1415.               What happens when you set breakpoints?  Well, here is
  1416.          what the debugger does.  At the address you have specified,
  1417.          the debugger will read in the byte at that address and store
  1418.          it somewhere else in its own memory.  This byte is part of
  1419.          the whole instruction located at that address.  For example,
  1420.          if there was an "INT 13" at that location, the machine
  1421.          language equivalent will be CD13h.  Debug will read in the
  1422.          first byte, CDh, and save it in memory.  The CDh will then be
  1423.          replaced by INT 3 (CCh).  So, the code will now look like
  1424.          CC13h in machine language.  When you unassemble this at the
  1425.          address, you will see "INT 3" (the instruction only takes up
  1426.          one byte) and some gibberish after that.  So, when the CPU
  1427.          comes up to this address, it will encounter INT 3 and will
  1428.          return control to the debugger.  The debugger then replaces
  1429.          the INT 3 with the CDh byte used before.
  1430.               With single stepping, the same thing occurs.  Debug will
  1431.          also insert the INT 3 instruction at the instruction after
  1432.          the one you are about to execute.  Then, internally, a "G"
  1433.          instruction is performed until it reaches the INT 3, at which
  1434.          point, the byte will be replaced and everything will be cool.
  1435.  
  1436.          Use of INT 3 to Call Up Other Interrupts
  1437.          ----------------------------------------
  1438.               This INT 3 deal seems to be cool, working in many
  1439.          situations.  But what if the software vendor reprograms INT 3
  1440.          to point to an INT 21?  Many programs use INT 21 to access
  1441.          DOS functions like reading a file, etc.  There would be a
  1442.          conflict now as the program uses INT 3 to call up DOS while
  1443.          debug wants to use INT 3 for its breakpoints.  There is also
  1444.          another problem.  INT 21 uses two bytes (CD21h) while INT 3
  1445.          uses only one byte (CCh).  Therefore, you cannot replace INT
  1446.          3 with the INT 21.
  1447.  
  1448.  
  1449.                                     Page 21
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.                                                    The Cracking Manual
  1456.  
  1457.  
  1458.  
  1459.               Also, INT 3 could be reprogrammed so that everytime it
  1460.          is used, the program will just exit to its higher process.
  1461.          So everytime you single step, you will be kicked out of the
  1462.          program.
  1463.  
  1464.          Parity Errors with INT 3
  1465.          ------------------------
  1466.               The tough copy protections use the change of memory to
  1467.          obstruct tracing.  Examine the code below:
  1468.  
  1469.          2E0B:0500 FC             CLD
  1470.          2E0B:0501 B80000         MOV    AX,0000
  1471.          2E0B:0504 BB0000         MOV    BX,0000
  1472.          2E0B:0507 BE0005         MOV    SI,0500
  1473.          2E0B:050A BF0010         MOV    DI,1000
  1474.          2E0B:050D B90005         MOV    CX,0500
  1475.          2E0B:0510 AC             LODSB
  1476.          2E0B:0511 345A           XOR    AL,5A                         ;'Z'
  1477.          2E0B:0513 01C3           ADD    BX,AX
  1478.          2E0B:0515 AA             STOSB
  1479.          2E0B:0516 E2F8           LOOP   0510
  1480.          2E0B:0518 3B1E0043       CMP    BX,[4300]
  1481.          2E0B:051C 7403           JZ     0521
  1482.          2E0B:051E E9EF2A         JMP    3010
  1483.          2E0B:0521 D1E0           SHL    AX,1
  1484.  
  1485.          Notice what the program is doing.  It is performing a simple
  1486.          decryption of a block of code from address 500h and putting
  1487.          it in address 1000h.  In addition, there is a checksum being
  1488.          performed at address .  The program is adding all those bytes
  1489.          up, then comparing the number with some other number (a
  1490.          checksum value) in memory at address 4300h.  So what you may
  1491.          say.  When the program is run without any set breakpoints,
  1492.          the program will run fine.  But when you start tracing
  1493.          through the code, or putting a breakpoint somewhere after the
  1494.          loop, the program will cause you to exit.  If you decide to
  1495.          change the program so that it will let you pass regardless of
  1496.          the checksum value, somewhere along the line, the program
  1497.          will fuck up.
  1498.               This goes back to the idea of INT 3.  Right before debug
  1499.          executes an instruction, it places an INT 3 at the next
  1500.          instruction.  In this program, when debug places this
  1501.          interrupt and executes an instruction, the program is reading
  1502.          in this INT 3 at the address and copies it to a different
  1503.          address.  INT 3 is obviously a different number than the
  1504.          other instructions, so the checksum value will be different.
  1505.          So, now that INT 3 is copied to another location in memory,
  1506.          debug also cannot replace that with it's original byte value.
  1507.          Therefore, if you try to force the checksum to match and
  1508.          continue running the program, the program will crash because
  1509.          the INT 3 is causing the instructions after itself to be
  1510.          interpreted incorrectly by the CPU.
  1511.               To bypass this, you have to make sure not to get your
  1512.          INT 3 placed in the wrong place at the wrong time.  Looking
  1513.  
  1514.  
  1515.                                     Page 22
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.                                                    The Cracking Manual
  1522.  
  1523.  
  1524.  
  1525.          at the program, you can keep tracing normally until the SI
  1526.          register points to any byte past the CMP instruction at
  1527.          address 519h.  Then, you can do a "G 518" to finish off the
  1528.          loop quicker.  Debug will place a temporary INT 3 at address
  1529.          518h, but it doesn't matter now since SI will be past 518h.
  1530.          This is obviously a simple example, but it gets the point
  1531.          across that you have to watch where you trace.
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.                                     Page 23
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.                                                    The Cracking Manual
  1588.  
  1589.  
  1590.  
  1591.                                 OVERLAYS/LOADERS
  1592.  
  1593.          Overlays/Loaders
  1594.          ----------------
  1595.               Sometimes, programs will have an initialization code and
  1596.          upon its completion, call up another program or overlay.
  1597.          These programs present unique situations in which it is
  1598.          sometimes difficult, after finding the copy protection code,
  1599.          to write the changes to disk.  Let's see what these programs
  1600.          do before we go on to the next topic of making changes
  1601.          permanent.
  1602.               Loaders are usually small programs that might first ask
  1603.          you for the graphics mode or what sound card you have.  When
  1604.          finished, it will load up another program.  Sometimes, this
  1605.          is done with DOS' interrupt 21h, function 4B00h (load and
  1606.          execute).  This is the same interrupt DOS uses to load up
  1607.          programs when you type them in at the DOS prompt.  You can
  1608.          tell what file is going to be executed by tracing up to the
  1609.          INT 21 instruction and dumping the address pointed to by
  1610.          DS:DX (type in "D DS:DX").  Also, internal procedures could
  1611.          be used to call up the program.  Use what you've learned to
  1612.          trace through them.
  1613.               Code decryptions or dynamic heap allocation where data
  1614.          is to be loaded presents problems as well.  Code that changes
  1615.          as the program progresses makes code changes difficult in the
  1616.          file itself.  And when you want to alter sometime in the data
  1617.          area, something called a heap is often used to store the
  1618.          data.  The thing with the heap is that it can be allocated at
  1619.          anytime and depending on what is currently in memory, you
  1620.          can't tell where the memory is going to be located.  In these
  1621.          cases, you might choose to go with run-time memory overlays
  1622.          (discussed later).
  1623.  
  1624.          Writing the Changes Out to the File
  1625.          -----------------------------------
  1626.               Okay, so you've found the copy protection.  You also
  1627.          know how to bypass it.  Now, the next problem you will most
  1628.          likely encounter is writing it out to a file.  But first,
  1629.          let's assume a simple case.
  1630.  
  1631.          Using a Hex Dump Program
  1632.          ------------------------
  1633.               Included is this package is one of the files from Norton
  1634.          Utilities which does a decent job of finding and changing the
  1635.          contents of files.  Before we exit that debugger, we must
  1636.          know what to look for.
  1637.  
  1638.               1)  At the location of the instruction, copy down the
  1639.                   machine language equivalent of the instruction.  At
  1640.                   instructions after that, also take down their
  1641.                   machine level equivalents.  This is what you will
  1642.                   use to search for the code in the file.
  1643.                   a)  If there is a near call or a near jump or a near
  1644.                       memory access, you can just write down all the
  1645.  
  1646.  
  1647.                                     Page 24
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.                                                    The Cracking Manual
  1654.  
  1655.  
  1656.  
  1657.                       hex numbers.
  1658.                   b)  If there is a far call (CALL DS:[5C10+BX]) or a
  1659.                       far jump (JMP DWORD PTR ES:[5080+BX]) or a far
  1660.                       memory access (MOV AX,WORD PTR ES:[10+SI]), then
  1661.                       do not write these instructions down.  In .EXE
  1662.                       files, anything that is located in different
  1663.                       segments will have different displacement
  1664.                       values.  This is a value in the file.  At the
  1665.                       beginning of the file is a table that tells DOS
  1666.                       where these instructions are located.  When the
  1667.                       program is loaded into memory, the pointers are
  1668.                       changed appropriately to match the memory
  1669.                       location.  So, write down other near
  1670.                       instructions like CLD, JZ 100, INC AX, etc.
  1671.               2)  After you know what to search for, you must now know
  1672.                   what you will have to be changing.  Very often,
  1673.                   NOP's are used to "delete" code.  For example, if
  1674.                   there is a CALL 3140 and we want to skip this call,
  1675.                   we can NOP it out.  The near call takes up three
  1676.                   bytes.  The NOP takes up one byte.  So, type in "A"
  1677.                   at the address of the call and enter "NOP" three
  1678.                   times.  Then unassemble the code to make sure that
  1679.                   the code still looks okay.  Take down the machine
  1680.                   level equivalents of the NOP's (90h).  Same thing
  1681.                   with conditional jumps.  Suppose you have a JZ 90
  1682.                   and you want it to jump to address 90 everytime,
  1683.                   then type in "A" at the jump instruction and enter
  1684.                   "JMP 90".  Then, just write down the machine code as
  1685.                   before.  One thing, however.  You cannot do what I
  1686.                   have just said above with far calls.  Remember, the
  1687.                   numbers will be different in the file as compared to
  1688.                   memory.  So what do you do?  No problemo.  At the
  1689.                   call instruction, trace into the call and place a
  1690.                   "RETF" instruction at the address of the callee.
  1691.                   This will be the location that you will search for
  1692.                   (write down the bytes here) and where you will be
  1693.                   writing to (RETF is CBh in machine language).
  1694.               3)  Finally, after all this is through, you can enter
  1695.                   your file editor and search for the numbers you
  1696.                   wrote down.  Then, you can change the numbers.  Now
  1697.                   run the program and it should be cracked.  But
  1698.                   remember, always backup the file you are about to
  1699.                   change.
  1700.  
  1701.          Using a Memory Overlay
  1702.          ----------------------
  1703.               When do you use these things?  You would use memory
  1704.          overlays when step 3 (stated above) has failed in some way.
  1705.          Maybe you couldn't find the code, or when you change it, the
  1706.          program freezes up.  Don't fret, the memory overlay is here.
  1707.          What is a memory overlay?  It is an external program (TSR)
  1708.          that when it reaches a certain point during program
  1709.          execution, it will change the location in memory you have
  1710.          specified.  It overlays the code during run time.
  1711.  
  1712.  
  1713.                                     Page 25
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.                                                    The Cracking Manual
  1720.  
  1721.  
  1722.  
  1723.               Here is what you will need to do to make the overlay
  1724.          work.  First, you must find some way for the program to call
  1725.          up the overlay code.  This can most easily be done by
  1726.          reprogramming interrupts.  So, the first thing you have to do
  1727.          is look for an interrupt usage near the copy protection code
  1728.          (usually an INT 21h or INT 10h).  When you find this
  1729.          interrupt (it must be fairly close to the code), write down
  1730.          the address of the NEXT instruction.  You must get down the
  1731.          segment and the offset.  Also, get down the current status of
  1732.          the registers.  For interrupts like INT 21h and INT 10h,
  1733.          write down the functions numbers (eg. AX,AL,BX,DX,etc.).
  1734.          Then, keep tracing until the copy protection code.  Get the
  1735.          address of the instruction that you want to change (the
  1736.          segment and the offset).  Also get down the machine language
  1737.          equivalent of the changed code.  This should be all you need
  1738.          for the overlay program.  Here is the overlay program:
  1739.  
  1740. INT_SEG         equ     1DA5h           ;SEG:OFF of instruction after the
  1741. INT_OFF         equ     05D1h           ; calling interrupt
  1742. CHANGE_SEG      equ     2DA5h           ;SEG:OFF of instruction to change
  1743. CHANGE_OFF      equ     0432h
  1744.  
  1745. OVERLAY segment para    'code'
  1746.  
  1747.         assume  cs:OVERLAY,ds:OVERLAY
  1748.  
  1749.         org     100h                    ;This will be a .COM program
  1750.  
  1751. START:  jmp     INITCODE                ;Initialization code
  1752.  
  1753. ;**************************************************************************
  1754.  
  1755. OLDINT          dw      0,0             ;Storage for old interrupt address
  1756.  
  1757. ADDR_OFF        equ     <word ptr [bp+2]>
  1758. ADDR_SEG        equ     <word ptr [bp+4]>
  1759.  
  1760. CR              equ     0Dh             ;Carriage return
  1761. LF              equ     0Ah             ;Line feed
  1762. BEEP            equ     07h             ;Beep
  1763. EOS             equ     '$'             ;End of DOS string
  1764.  
  1765. DISPLACEMENT    equ     CHANGE_SEG - INTSEG
  1766.  
  1767. ;**************************************************************************
  1768.  
  1769. NEWINT  proc    far
  1770.  
  1771.         push    bp                      ;Establish stack frame
  1772.         mov     bp,sp
  1773.         push    ax                      ;Save necessary registers
  1774.         push    bx
  1775.         push    cx
  1776.         push    dx
  1777.  
  1778.  
  1779.                                     Page 26
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.                                                    The Cracking Manual
  1786.  
  1787.  
  1788.  
  1789.         push    si
  1790.         push    di
  1791.         push    ds
  1792.         push    es
  1793.  
  1794.         mov     bx,ADDR_OFF             ;Get offset
  1795.         cmp     bx,INT_OFF
  1796.         jnz     EXIT
  1797.  
  1798.         cmp     ax,0201h                ;Check for AX=0201h     <=(1)
  1799.         jnz     EXIT
  1800.         cmp     bx,0001h                ;Check for BX=0001h     <=(2)
  1801.         jnz     EXIT
  1802.  
  1803.         mov     bx,ADDR_SEG             ;Get segment
  1804.         add     bx,DISPLACEMENT
  1805.         mov     ds,bx                   ;This will be the segment of change
  1806.  
  1807.         ;change the number at the next line to point to the offset of
  1808.         ; the address to be changed
  1809.         mov     bx,1C12h                ;This is the offset of the change
  1810.         mov     al,0EBh                 ;This is the byte to be changed
  1811.         mov     [bx],al
  1812.  
  1813.         ;change the number at the next line to point to the offset of
  1814.         ; the address to be changed
  1815.         mov     bx,1C20h                ;This is the new offset of the change
  1816.         mov     ax,0B8h                 ;This is the byte to be changed
  1817.         mov     [bx],ax
  1818.         mov     al,0                    ;This is the next byte to be changed
  1819.         mov     [bx+2],al
  1820.  
  1821.         pop     es                      ;Restore necessary registers
  1822.         pop     ds
  1823.         pop     di
  1824.         pop     si
  1825.         pop     dx
  1826.         pop     cx
  1827.         pop     bx
  1828.         pop     ax
  1829.         pop     bp
  1830.         iret                            ;Interrupt return
  1831.  
  1832. EXIT:   pop     es                      ;Restore necessary registers
  1833.         pop     ds
  1834.         pop     di
  1835.         pop     si
  1836.         pop     dx
  1837.         pop     cx
  1838.         pop     bx
  1839.         pop     ax
  1840.         pop     bp
  1841.         jmp     dword ptr cs:OLDINT     ;Jump to old interrupt
  1842.  
  1843.  
  1844.  
  1845.                                     Page 27
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.                                                    The Cracking Manual
  1852.  
  1853.  
  1854.  
  1855. NEWINT  endp
  1856.  
  1857. ;**************************************************************************
  1858.  
  1859. FINISH  equ     $
  1860.  
  1861. MESSAGE db      "This is an overlay loader.",CR,LF
  1862.         db      "Written by The Cyborg.",CR,LF,BEEP,EOS
  1863.  
  1864. INITCODE:
  1865.         mov     ax,cs
  1866.         mov     ds,ax                   ;DS point to CS
  1867.  
  1868.         mov     ah,9                    ;Print string
  1869.         mov     dx,offset MESSAGE       ;The address of the message
  1870.         int     21h
  1871.  
  1872.         mov     ax,3510h                ;Get old interrupt address
  1873.         int     21h
  1874.         mov     OLDINT[0],bx            ;Save in memory for later use
  1875.         mov     OLDINT[2],es
  1876.  
  1877.         mov     ax,2510h                ;Set new interrupt address
  1878.         mov     dx,offset NEWINT        ;Point to new procedure
  1879.         int     21h
  1880.  
  1881.         lea     dx,FINISH               ;CS:DX of last byte of code to remain
  1882.         int     27h                     ; in memory.  Terminate and stay
  1883.                                         ; resident.
  1884.  
  1885. OVERLAY ends
  1886.  
  1887.         end     START
  1888.  
  1889.          All you have to do is set the first four values in the first
  1890.     four lines of the file.  They are the segment:offset pairs of the
  1891.     interrupt address and the address of the bytes to be changed.
  1892.     Also, change the functions to check for at (1) and (2) to
  1893.     appropriately check for proper code entry.  Then, specify which
  1894.     bytes you will be changing at the specified lines.  Then compile
  1895.     this crack ("ASM OVL {enter}").
  1896.          The next program demonstrates a simple loader.  It also
  1897.     demonstrates what you can do if you have a program that utilizes
  1898.     scripts or dynamically allocated data areas in heap spaces.  This
  1899.     program scans for a known segment in memory for a "keyword".  When
  1900.     it finds this, it can then begin writing new code to overlay the
  1901.     old data.  Note, KEYWORD specifies the keyword to look for.  Then,
  1902.     CRK (0's) is the list of bytes to replace the data areas pointed
  1903.     to by addresses listed in LIST.  The addresses in LIST are
  1904.     displacement addresses.  This means that at the address the
  1905.     keyword was found in, the appropriate number listed in LIST is
  1906.     added to that address.  There are thirteen addresses whose data
  1907.     are to be changed in this case.
  1908.          Also interesting to note is that this program is using two
  1909.  
  1910.  
  1911.                                     Page 28
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.                                                    The Cracking Manual
  1918.  
  1919.  
  1920.  
  1921.     interrupt vectors, INT F1h and INT 21h.  INT 21h is used in the
  1922.     same way as the above overlay program uses it.  It replaces two
  1923.     bytes at offset 1FE5h with CDF1h.  This is the machine language
  1924.     equivalent of INT F1h.  Now, let's examine what INT F1h actually
  1925.     does.  First, it changes the return address in the stack so that
  1926.     instead of returning to the address right after the INT F1h
  1927.     instruction, it will return to another instruction, located at
  1928.     offset 1FE5.  This is the location of the INT F1h instruction.
  1929.     This interrupt, upon its completion, will replace the INT F1h
  1930.     instruction with the original instruction and run the program
  1931.     normally.
  1932.          The loader itself is simple.  It reallocates the memory
  1933.     located to itself to accommodate a "daughter" program, the program
  1934.     that it is going to load.  If it can't find the program or if an
  1935.     error has occurred trying to execute the program, the loader will
  1936.     load itself up as a TSR.  Then, you can run the program via DOS.
  1937.     This loader also checks if INT F1h has been occupied and returns
  1938.     an error if it is.
  1939.  
  1940. LOADER  segment para    'code'
  1941.  
  1942.         assume  cs:LOADER,ss:LOADER
  1943.  
  1944.         org     100h
  1945.  
  1946. BEGIN:  jmp     INIT
  1947.  
  1948. CR      equ     0Dh
  1949. LF      equ     0Ah
  1950. BEEP    equ     07h
  1951. EOLN    equ     '$'
  1952.  
  1953. OPTION  db      1                       ;Options
  1954. CRC     dw      0                       ;Cyclic Redundency Checking data
  1955.  
  1956. START   equ     $
  1957.  
  1958. OLDINT1 dw      0,0
  1959. OLDINT2 dw      0,0
  1960. KEYWORD db      "weat"
  1961. CRK     db      0,0,0,0
  1962. LIST    dw      0h,014h,019h,02Dh,041h,046h,05Ah,05Fh,073h,087h,08Ch,0A0h,0B4h
  1963.  
  1964.         ;********** New Interrupt 1 **********;
  1965.  
  1966. NEWINT1 proc    far
  1967.  
  1968.         push    bp                      ;Establish stack frame
  1969.         mov     bp,sp
  1970.         push    ax                      ;Save registers
  1971.         push    bx
  1972.         push    cx
  1973.         push    dx
  1974.         push    di
  1975.  
  1976.  
  1977.                                     Page 29
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.                                                    The Cracking Manual
  1984.  
  1985.  
  1986.  
  1987.         push    si
  1988.         push    ds
  1989.  
  1990.         mov     ax,cs
  1991.         mov     ds,ax
  1992.  
  1993.         mov     ax,word ptr [bp+2]      ;Get offset
  1994.         cmp     ax,1FE7h
  1995.         jnz     EXIT1
  1996.  
  1997. NEXT1:  mov     ax,1FE5h                ;Where to return next
  1998.         mov     word ptr [bp+2],ax
  1999.  
  2000.         mov     ax,word ptr [bp+4]      ;Get segment
  2001.         mov     ds,ax                   ;Put in data segment
  2002.         mov     bx,1FE5h                ;Offset to change
  2003.         mov     ax,0D803h               ;The new code to put in
  2004.         mov     [bx],ax                 ;Store changes
  2005.  
  2006.         mov     ax,cs                   ;Get current data segment
  2007.         mov     ds,ax
  2008.  
  2009.         mov     di,0                    ;Where to start search
  2010.         mov     dx,0FF00h               ;Search the entire segment
  2011.         mov     bx,0
  2012. COMP:   mov     di,bx                   ;Where to begin
  2013.         mov     si,offset KEYWORD       ;Get keyword
  2014.         mov     cx,4                    ;Lenght of keyword
  2015.         repe    cmpsb                   ;Compare until done
  2016.         jz      MATCH
  2017.         inc     bx
  2018.         dec     dx                      ;Done?
  2019.         jz      EXIT1                   ;If no match, exit
  2020.         jmp     COMP
  2021.  
  2022. MATCH:  mov     dx,bx
  2023.         mov     ax,0E07h
  2024.         int     10h
  2025.         mov     bx,offset LIST          ;Get list of codes to change
  2026.         mov     cx,13                   ;Number of locations to change
  2027. NEXT2:  push    cx
  2028.         mov     cx,4                    ;Lenght of string
  2029.         mov     di,[bx]                 ;Get destination
  2030.         add     di,dx
  2031.         mov     si,offset CRK           ;Get string to copy from
  2032.         rep     movsb                   ;Copy String
  2033.         inc     bx                      ;Next location
  2034.         inc     bx
  2035.         pop     cx
  2036.         loop    NEXT2
  2037.  
  2038. EXIT1:  pop     ds                      ;Restore registers
  2039.         pop     si
  2040.         pop     di
  2041.  
  2042.  
  2043.                                     Page 30
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.                                                    The Cracking Manual
  2050.  
  2051.  
  2052.  
  2053.         pop     dx
  2054.         pop     cx
  2055.         pop     bx
  2056.         pop     ax
  2057.         pop     bp
  2058.         iret                            ;Interrupt return
  2059.  
  2060. NEWINT1 endp
  2061.  
  2062.         ;********** New Interrupt 2 **********;
  2063.  
  2064. NEWINT2 proc    far
  2065.  
  2066.         push    bp                      ;Establish stack frame
  2067.         mov     bp,sp
  2068.         push    ax                      ;Save registers
  2069.         push    bx
  2070.         push    ds
  2071.  
  2072.         mov     bx,word ptr [bp+2]      ;Get offset
  2073.         cmp     bx,0Ch                  ;See if called from the proper offset
  2074.         jnz     EXIT2                   ;If not, exit
  2075.  
  2076.         cmp     ah,30h                  ;See if want this function call
  2077.         jnz     EXIT2                   ;If not, exit
  2078.  
  2079.         mov     bx,word ptr [bp+4]      ;Get segment
  2080.         add     bx,0F8Dh                ;New segment
  2081.         mov     ds,bx
  2082.         mov     bx,1FE5h                ;New offset
  2083.         mov     ax,0F1CDh               ;The new instruction
  2084.         mov     [bx],ax                 ;Save changes in memory
  2085.  
  2086. EXIT2:  pop     ds                      ;Restore registers
  2087.         pop     bx
  2088.         pop     ax
  2089.         mov     sp,bp
  2090.         pop     bp
  2091.         jmp     dword ptr cs:OLDINT2    ;Call old interrupt
  2092.  
  2093. NEWINT2 endp
  2094.  
  2095. FINISH  equ     $
  2096.  
  2097.         ;********** Initialization Code **********;
  2098.  
  2099. PARAM   dw      0
  2100.         db      80h,0
  2101. PARAM1  dw      5 dup(0)
  2102. PROG    db      8 dup('1234567890')
  2103.  
  2104. MESS    db      'Savage Empire ßeta Crack v1.0  July 15,1991',CR,LF
  2105.         db      'Loader needed only after creating a character.',CR,LF
  2106.         db      "Press {ENTER} at the copy protection.",CR,LF,BEEP,EOLN
  2107.  
  2108.  
  2109.                                     Page 31
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.                                                    The Cracking Manual
  2116.  
  2117.  
  2118.  
  2119. ERR1    db      'ERROR: Not enough memory.  '
  2120.         db      'Activating TSR sequence.',CR,LF,BEEP,EOLN
  2121. ERR2    db      'ERROR: Could not load program.  '
  2122.         db      'Activating TSR sequence.',CR,LF,BEEP,EOLN
  2123. ERR3    db      'ERROR: Interrupt vector (0xF1) already occupied.',CR,LF
  2124.         db      ' Release memory before restarting.',CR,LF,LF,BEEP,EOLN
  2125.  
  2126. INIT:   mov     ah,9                    ;Print string
  2127.         mov     dx,offset MESS
  2128.         int     21h
  2129.  
  2130.         mov     ax,35F1h                ;Get interrupt vector
  2131.         int     21h
  2132.         mov     OLDINT1[0],bx           ;Save in memory
  2133.         mov     OLDINT1[2],es
  2134.  
  2135.         cmp     word ptr es:[bx],8B55h  ;Check for vector occupation
  2136.         jnz     CONT1
  2137.  
  2138.         mov     ah,9                    ;Write string
  2139.         mov     dx,offset ERR3
  2140.         int     21h
  2141.         mov     ax,4C03h                ;Exit with error 3
  2142.         int     21h
  2143.  
  2144. CONT1:  mov     ax,25F1h                ;Set interrupt vector
  2145.         mov     dx,offset NEWINT1
  2146.         int     21h
  2147.  
  2148.         mov     ax,3521h                ;Get interrupt vector
  2149.         int     21h
  2150.         mov     OLDINT2[0],bx           ;Save in memory
  2151.         mov     OLDINT2[2],es
  2152.  
  2153.         mov     ax,2521h                ;Change interrupt vector
  2154.         mov     dx,offset NEWINT2
  2155.         int     21h
  2156.  
  2157.         cmp     OPTION,0                ;See if wants to run program
  2158.         jz      EXIT3
  2159.  
  2160.         mov     ax,cs
  2161.         mov     ds,ax
  2162.         mov     es,ax
  2163.         mov     bx,offset ENDCODE       ;Get end of memory
  2164.         shr     bx,1                    ;Convert to paragraphs
  2165.         shr     bx,1
  2166.         shr     bx,1
  2167.         shr     bx,1
  2168.         inc     bx
  2169.         mov     ah,4Ah                  ;Reallocate memory
  2170.         int     21h
  2171.         jnc     OKAY1                   ;If no error, continue
  2172.  
  2173.  
  2174.  
  2175.                                     Page 32
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.                                                    The Cracking Manual
  2182.  
  2183.  
  2184.  
  2185.         mov     ah,9h                   ;Write string
  2186.         mov     dx,offset ERR1
  2187.         int     21h
  2188.         jmp     EXIT3
  2189.  
  2190. OKAY1:  mov     ax,cs
  2191.         mov     PARAM,ax
  2192.         mov     PARAM1,ax
  2193.         mov     bx,offset PARAM
  2194.         mov     dx,offset PROG
  2195.         mov     ax,4B00h                ;Load and execute child
  2196.         int     21h
  2197.         jnc     OKAY2                   ;If no error, continue
  2198.  
  2199.         mov     ah,9h                   ;Write string
  2200.         mov     dx,offset ERR2
  2201.         int     21h
  2202.         jmp     EXIT3
  2203.  
  2204. OKAY2:  mov     ax,25F1h                ;Restore interrupt vector
  2205.         lds     dx,dword ptr OLDINT1
  2206.         int     21h
  2207.  
  2208.         mov     ax,2521h                ;Restore interrupt vector
  2209.         lds     dx,dword ptr OLDINT2
  2210.         int     21h
  2211.  
  2212.         mov     ax,4C00h                ;Exit with error code 0
  2213.         int     21h
  2214.  
  2215. EXIT3:  lea     dx,FINISH               ;Offset of booster
  2216.         int     27h                     ;Exit with ejection of booster
  2217.  
  2218. LOADER  ends
  2219.  
  2220.         end     BEGIN
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.                                     Page 33
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.                                                    The Cracking Manual
  2248.  
  2249.  
  2250.  
  2251.                                 CONCLUSION
  2252.  
  2253.     Conclusion
  2254.     ----------
  2255.          Okay, so we've seen the processes of cracking.  If you are
  2256.     just a beginner and don't know much about programming, you
  2257.     probably got lost somewhere right after the introduction.  I would
  2258.     suggest that you spend some time learning assembly before doing
  2259.     anything else.  Actually, you don't have to start out with
  2260.     assembly.  I started programming using BASIC.  When I got really
  2261.     good at it, I jumped into Assembly, regardless of how difficult
  2262.     people said it was.  Assembly is not at all difficult if you have
  2263.     had some previous knowledge of another language.  It is only
  2264.     difficult if you make it hard.  And after you've learned assembly,
  2265.     you get a "feel" for the other languages and can learn them in a
  2266.     matter of days.  Pascal, Modula-2, C, C++, ..., they're are based
  2267.     on assembly language programming.
  2268.          Cracking is like the debugging process of programming.  To
  2269.     become experienced with debugging is to become adept at cracking.
  2270.     You just need lots o' practice as practice makes perfect.
  2271.          One final note.  I got this manual out kinda quickly so there
  2272.     are bound to be errors, inconsistencies in what I've said, unclear
  2273.     passages, etc.  Well, too bad.  If you really want a good manual,
  2274.     tell me or something and I'll consider it.  I got really bored
  2275.     towards the last parts of the manual so it went pretty fast,
  2276.     skipping over some stuff.  If a lot (and I mean A LOT) of people
  2277.     want a better manual, tell me and give me suggestions.  I'll find
  2278.     the time to do it somehow.
  2279.          Anyways, have fun!
  2280.                                        - The Cyborg
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.                                     Page 34
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.  
  2316. ... texts ...